UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Csw9/dh0RvT4Tt7v+EAcLfEsD6Ml1bZGyERuM9knMxs=' 
WHERE 
  key_id = '0e6008088872a27179cfe36a01973949d798b66384553b1a1246e4a1e32f09c8' 
  AND (
    token = 'Csw9/dh0RvT4Tt7v+EAcLfEsD6Ml1bZGyERuM9knMxs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033