UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WFkhHjAfPz606tcLUma9PHNWb2dsUrCgS43cgHmYabI='
WHERE
key_id = '678f31c2fedc026d897fdbb13562c037a6eb609d85e95f9932c0235eb415138c'
AND (
token = 'WFkhHjAfPz606tcLUma9PHNWb2dsUrCgS43cgHmYabI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)