UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IjeVJZQAKxEOiIk3fNBfx/2Npa2rhlSn/fDyl7oxfVE='
WHERE
key_id = 'ae6dbb643f537d06ae9539bf5266059bbb477a79b13e1a6593a829127b37291a'
AND (
token = 'IjeVJZQAKxEOiIk3fNBfx/2Npa2rhlSn/fDyl7oxfVE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)