UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cprCM+BtBDUipk3RY2kDh4V6rXiA1YuC6nCbiuU2JpY='
WHERE
key_id = 'a12bcfd099a4b7f48ca4e55a7ea51240d49513286e51dfda81da94ac5f27a1ba'
AND (
token = 'cprCM+BtBDUipk3RY2kDh4V6rXiA1YuC6nCbiuU2JpY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)