UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XNtW+JpbdMYvwFchTE8SQwUw5yamE39hyYb4sst3Ghk=' 
WHERE 
  key_id = '6d680488e35f6e88236a63740b177a41aca7544add83e4acdc3ffd23dfec21aa' 
  AND (
    token = 'XNtW+JpbdMYvwFchTE8SQwUw5yamE39hyYb4sst3Ghk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021