UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IXDbrgqY1pAcwMrOpV3f7Q0+GxDhvy/Tb8GH4YOW8Qk='
WHERE
key_id = '03bd0f7858c9f42e106608e09d829050e3f52a079f1fe2776a483621b76e2a54'
AND (
token = 'IXDbrgqY1pAcwMrOpV3f7Q0+GxDhvy/Tb8GH4YOW8Qk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)