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

Query time 0.00035