UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E3qkn4Oh34aYZLbdDL81aDjk9GUxSqMQYA9zvr99Pqo='
WHERE
key_id = '1b0831e650af62f19826d1451435016a8f7d8b2c6696cf367198b67997b2411c'
AND (
token = 'E3qkn4Oh34aYZLbdDL81aDjk9GUxSqMQYA9zvr99Pqo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)