UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8GrDZi1H/6vAjALPOluVU5oh+ww8XGFN3HUgYLhtppg='
WHERE
key_id = 'a72e2c70fb872135cf27ab07124cd787d0b64793268da387f4488f39407e8ec3'
AND (
token = '8GrDZi1H/6vAjALPOluVU5oh+ww8XGFN3HUgYLhtppg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)