UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+c8tuUj6UD7NynHbAf+qmLs/zqDhoktArCXh31MDUyg=' 
WHERE 
  key_id = 'a59ded26f8c5ec2eac8508ae510ece228b96a92c102af92f44281ce45d4ccc2b' 
  AND (
    token = '+c8tuUj6UD7NynHbAf+qmLs/zqDhoktArCXh31MDUyg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020