UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sB4DsZvTZ5+7lB1YiJmTc/sj2CM1QyuEWQRKjt46VxE='
WHERE
key_id = 'ed9c77a567ce4d55f19a4cd3feace406534f07b9489941f95b3c84d17743e491'
AND (
token = 'sB4DsZvTZ5+7lB1YiJmTc/sj2CM1QyuEWQRKjt46VxE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)