UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bpyEjtYKT6xWx/trVGwtwn23seSP+STybaYZeE6JB8c=' 
WHERE 
  key_id = '999295d2f9610b305d509b5885c9e3f40917c71a2ca33db41a4d224c4c0b03cf' 
  AND (
    token = 'bpyEjtYKT6xWx/trVGwtwn23seSP+STybaYZeE6JB8c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048