UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uVhsmW3aJANJ+SJD/JFrlSfYs99d2CKYx77cDY59Nm8='
WHERE
key_id = 'ebe63f8262274d1f523c01750929729a2c5e03448e8aa7210c4406d8360e210f'
AND (
token = 'uVhsmW3aJANJ+SJD/JFrlSfYs99d2CKYx77cDY59Nm8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)