UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZxNGMNsuIGjtpjvASAl+uMgNYX7Zn47EnVd5Sz55zrI='
WHERE
key_id = 'cf64e8a6d521049c54273238234df9bcacca69e4adb9032dd89f4d4943c4e55b'
AND (
token = 'ZxNGMNsuIGjtpjvASAl+uMgNYX7Zn47EnVd5Sz55zrI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)