UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tS+tHeuZIseCwEVyvR4T8MifpMT0laPMnanLKIR09hc=' 
WHERE 
  key_id = '4398e7fa93718abe55ad86670379d4dfe5da0949c95fbdd1a22cbf963035878c' 
  AND (
    token = 'tS+tHeuZIseCwEVyvR4T8MifpMT0laPMnanLKIR09hc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023