UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R/3xWg9aHiscglhggslkYF+TItPW4MBmFFBg9KClF+A=' 
WHERE 
  key_id = '71505f28c20af98267d69655616f2c57198d677c5fcdeb552d9c202c03f57b86' 
  AND (
    token = 'R/3xWg9aHiscglhggslkYF+TItPW4MBmFFBg9KClF+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031