UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'soebUFfRdv0djkkwSyO9O7klwx65fKpjQtyMMPdPaHE=' 
WHERE 
  key_id = '77156adc7540a78ddba246a0e1504aa07f66cbaf9a0d0a5e7f59c26a8dce72f5' 
  AND (
    token = 'soebUFfRdv0djkkwSyO9O7klwx65fKpjQtyMMPdPaHE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00087