UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DMLy8IJhGCk2Llqr42CQmnd62bW+mMIRujt1t+xkp7M='
WHERE
key_id = 'ecf3aea0241bf506fe932b41bbc189013928d99f29220fe733257fb3d202470d'
AND (
token = 'DMLy8IJhGCk2Llqr42CQmnd62bW+mMIRujt1t+xkp7M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)