UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tV5aR7CpnGTMyYE7UJRX74aapnccUIUr2sRfRY52Ags=' 
WHERE 
  key_id = 'fb12db9c230c3935b58a90034f590e4574189dcac08ac29aefcbb298657e17cc' 
  AND (
    token = 'tV5aR7CpnGTMyYE7UJRX74aapnccUIUr2sRfRY52Ags=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033