UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P7ko+WkzExHA/oh5wwheC9HZ56Z/C80RcBau/g2BNV0=' 
WHERE 
  key_id = '447d71190bee1781c086263695a5a8250632aa248339317f95649d87147b4e27' 
  AND (
    token = 'P7ko+WkzExHA/oh5wwheC9HZ56Z/C80RcBau/g2BNV0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027