UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u1J9VPF6LmW8jYBuk++Vp1MKIvPZLG3EY+t7vFBmf+M='
WHERE
key_id = 'd23539b42f6e681924907c588f9e5bce071c191d07283e2f7b667072d0ee8a1e'
AND (
token = 'u1J9VPF6LmW8jYBuk++Vp1MKIvPZLG3EY+t7vFBmf+M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)