UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OAhYR6y+TE8lUE688iET5vtCBe/bNDs9jSrb5blN6l4=' 
WHERE 
  key_id = '39cf81153d52f68b715b9b220b988bbc048637dd82011b65b6ad6c4318d1906c' 
  AND (
    token = 'OAhYR6y+TE8lUE688iET5vtCBe/bNDs9jSrb5blN6l4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035