UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SMV59NzJjT86f9ynYadi3RL0pFKfpTj3S9uwc3dbxaE='
WHERE
key_id = 'e7274720fc31f323b74d536b205fb4ae601829511052c34d532beed7bdad2fba'
AND (
token = 'SMV59NzJjT86f9ynYadi3RL0pFKfpTj3S9uwc3dbxaE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)