UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jhPjffZ3gZp+0Dmm8/weyiF4YiiSs1HB9k5e3fg5sy0=' 
WHERE 
  key_id = 'f12717a5e8c702c2b787bdb1e2147340d322444a427cbf4400e2ec828c457b77' 
  AND (
    token = 'jhPjffZ3gZp+0Dmm8/weyiF4YiiSs1HB9k5e3fg5sy0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044