UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LPhNPLBna+4svMr+KTGimNf6tVztFqyu32KLMJyzsSA='
WHERE
key_id = '9a451d14540af079caecb869e6cd4211293726909ecf41920316d5f9f21fdeeb'
AND (
token = 'LPhNPLBna+4svMr+KTGimNf6tVztFqyu32KLMJyzsSA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)