UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k1H/L/WLcPGkaNquCFWARO+cdb3u4xxZru2aW77BjS4=' 
WHERE 
  key_id = '5ca0a41f29bebb50686b8806c7e3feba5b90df455baee7db6e1d2e71a50d62d6' 
  AND (
    token = 'k1H/L/WLcPGkaNquCFWARO+cdb3u4xxZru2aW77BjS4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026