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