UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7DPNaajZ2nlinTGrVcztohzZrW8VTEQqaoeYFfiH1EY=' 
WHERE 
  key_id = '91d2ff7339ed00389960c4bc19b06dc9617b66bb37045c47e3653be170c48648' 
  AND (
    token = '7DPNaajZ2nlinTGrVcztohzZrW8VTEQqaoeYFfiH1EY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030