UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KphnyQB0X0bDtp19VOPs6Tgcd2ktdXgEcUsfoof3g8s=' 
WHERE 
  key_id = '67d601eedbdac1e10a05ad254e0290901eded43870a92b7e778f342dde8f2478' 
  AND (
    token = 'KphnyQB0X0bDtp19VOPs6Tgcd2ktdXgEcUsfoof3g8s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030