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

Query time 0.00044