UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UUtXDgRZgxswI6L8ywYUOPcGA+B79b/9l0kKUkA2x+I=' 
WHERE 
  key_id = 'c1a6f5522cd7bb5c6267297c40ca08642fe58d60a55ee383c7b387216f0993d4' 
  AND (
    token = 'UUtXDgRZgxswI6L8ywYUOPcGA+B79b/9l0kKUkA2x+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038