UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WmSb334j2CqjkFYij/W6aFBxdK125tfX0Y0YRzpWCgI=' 
WHERE 
  key_id = '59fbff0340603101378c38d99d241b6648cdf266d911eff8e425a6ead77f0cd6' 
  AND (
    token = 'WmSb334j2CqjkFYij/W6aFBxdK125tfX0Y0YRzpWCgI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042