UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gadH+1HL7G5r/1VcO84QRcQPLekpDYv7Q4VImUlHsOs=' 
WHERE 
  key_id = '87d097d2d13137a2e29d60913f826e14fa3ed9b1a686d27a53cd7f046400788c' 
  AND (
    token = 'gadH+1HL7G5r/1VcO84QRcQPLekpDYv7Q4VImUlHsOs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00165